package cn.edu.hunau.oop.day06;

import org.junit.Test;

/**
 * @author hb
 * @date 2025-08-11 11:17:20
 */
public class TestStringBuilder {

    @Test
    public void test01(){
        StringBuilder sb=new StringBuilder("0123");
        sb.append("_abc");
        System.out.println(sb);//0123_abc
        sb.reverse();//反转
        System.out.println(sb);//cba_3210
        sb.delete(0,2);
        System.out.println(sb);//a_3210
    }

    @Test
    public void addContentString(){
        String a="";
        for(int i=0;i<1000000;i++){
            a+="A";
        }
    }

    @Test
    public void addContentStringBuilder(){
        StringBuilder sb=new StringBuilder();
        for(int i=0;i<1000000;i++){
            sb.append("A");
        }
    }
}
